<template>
	<view>
		<view class="group_3 flex-row justify-between" v-for="(item,index) in datalist" :key="index">
			<view class="image-text_15 flex-row justify-between">
				<image class="image_4" referrerpolicy="no-referrer" :src="item.project_img" />
				<text class="text-group_9">{{item.project_name}}</text>
			</view>
			<button class="cu-btn round anbutton bg-black" @click="onClick(item.id)">
				<text class="text_6">我要报名</text>
			</button>
		</view>

	</view>
</template>

<script>
	var app = getApp()
	export default {
		data() {
			return {
				pagenum: 1,
				datalist: [],
				nomore: false,
				nodata: false,
			}
		},
		onLoad() {
			var that = this
			that.getdata()
		},
		onReachBottom: function() {
			if (!this.nodata && !this.nomore) {
				this.pagenum = this.pagenum + 1;
				this.getdata(true);
			}
		},
		methods: {
			getdata(loadmore) {
				if (!loadmore) {
					this.pagenum = 1;
					this.datalist = [];
				}
				var that = this
				app.post('ApiProjectPublish/projectlist', {
					pagenum: that.pagenum,
				}, function(res) {
					var data = res.data;
					if (that.pagenum == 1) {
						that.datalist = data;
						if (data.length == 0) {
							that.nodata = true;
						}
						that.loaded();
					} else {
						if (data.length == 0) {
							that.nomore = true;
							that.nodata = true;
						} else {
							var datalist = that.datalist;
							var newdata = datalist.concat(data);
							that.datalist = newdata;
						}
					}
				});
			},
			onClick(e) {
				uni.navigateTo({
					url: '/activity/project/detailproject?id=' + e
				})
			},
		}
	}
</script>

<style>
	.group_3 {
		background-color: rgba(255, 255, 255, 1);
		border-radius: 15px;
		width: 355px;
		margin-top: 10px;
		padding: 10px 15px 10px 10px;
		margin-left: 55rpx;
	}

	.image-text_15 {
		width: 237px;
	}

	.image_4 {
		width: 108px;
		height: 78px;
	}

	.text-group_9 {
		overflow-wrap: break-word;
		color: rgba(24, 29, 24, 1);
		font-size: 18px;
		font-family: PingFangSC-Medium;
		font-weight: 500;
		text-align: left;
		white-space: nowrap;
		line-height: 25px;
		margin-top: 5px;
	}

	.text-wrapper_1 {
		background: url(https://lanhu.oss-cn-beijing.aliyuncs.com/SketchPng3f23e2a7831ca441cbb1fc8ea919047d3f37afc58d890076ab8494e19b78652e) 100% no-repeat;
		background-size: 100% 100%;
		margin-top: 50px;
		padding: 5px 16px 5px 16px;
	}

	.text_6 {
		overflow-wrap: break-word;
		color: rgba(255, 255, 255, 1);
		font-size: 14px;
		font-family: PingFangSC-Medium;
		font-weight: 500;
		text-align: left;
		white-space: nowrap;
		line-height: 16px;
	}
	.anbutton {
		background: #994278;
		background-color: #994278;
		color: white;
		margin-top: 90rpx;
	}
</style>